<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //1.求1-100之间所有数的平均值
        var num = 0;
        for (var i = 1; i <= 100; i++) {
            num += i;
        }
        var avg = num / 100;
        console.log('平均值为:' + avg);
        //2.求1-100之间所有偶数和奇数的和
        var num = 0;
        var num1 = 0;
        for (var i = 1; i <= 100; i++) {
            if (i % 2 == 0) {
                num += i;
            } else {
                num1 += i;
            }
        }
        var sum = num1 + num;
        console.log('偶数和:' + num);
        console.log('奇数和:' + num1);
        console.log('偶数和奇数的和为:' + sum);
        //3.求1-100之间所有能被3整除的数字的和
        var num = 0;
        for (var i = 1; i <= 100; i++) {
            if (i % 3 == 0) {
                num += i;
            }

        }
        console.log('能被三整除的数的和:' + i);
    </script>
</head>

<body>

</body>

</html>